import request from '@/utils/request'
import storage from '@/utils/storage'
import constant from '@/utils/constant'

//新增文件信息
export function addFile(fileName,fileType,hashCode,size,storeLocation) {
  const data = {
    "moduleId": 2,
    "outerId": 0,
    "innerId": 0,
    "suffix": fileType,
    "uploadDate": "2007-04-26",
    "uploaderId": 0,
    "storeName": fileName,
    "originalName": fileName,
    size,
    "deleteFlag": 0,
    storeLocation,
    "filePages": 3,
    "remarks": "nulla est labore",
    hashCode
	}
	const user = storage.get(constant.user);
	data.uploaderId = user.userId
  return request({
    'url': '/printer/fileManage',
    headers: {
      isToken: true
    },
    'method': 'post',
    'data': data
  })
}


//查询文件列表信息
export function getPrintFileList() {	
  const data = {
    "deleteFlag": 0
	}
	const user = storage.get(constant.user);
	data.uploaderId = user.userId
  return request({
    'url': '/printer/fileManage/list',
    headers: {
      isToken: true
    },
    'method': 'get',
    'data': data
  })
}

//设置文件参数
export function setPrintFileParam(data) {	
  return request({
    'url': '/printer/fParameter',
    headers: {
      isToken: true
    },
    'method': 'put',
    'data': data
  })
}